package com.bj58.mis.apm.apm.scf.mapper;

import com.bj58.mis.apm.apm.scf.module.KylinProject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @author zhangyu84
 * @create 2018/7/6
 * @since 1.0.0
 */
public interface KylinProjectRepository extends JpaRepository<KylinProject,Long> {
   KylinProject getByNameAndDeleted(String name,int deleted);

   @Modifying
   @Query(value = "update kylin_project c,roc_auth_project  r\n" +
           "set c.name=r.project_name_ch\n" +
           "where c.id=r.project_id and r.project_name_ch is not null",nativeQuery = true)
   void updateProjectNameCh();
}
